<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
      <h2>{{msg | format("good")}}</h2>
      <h2>{{msg | partone("bad")}}</h2>
  </div>
  <script src="./vue.js"></script>
  <script>
      Vue.filter('format',function(val,data) {
          if(val) {
              return val + data + ' 全局过滤器'
          }
          return '默认值'
      })

    var vm = new Vue({
      el:'#app',
      data:{
        msg:  'vue filter'
      },
      filters: {
          partone: function(val,data) {
            if(val) {
              return val + data + ' 局部过滤器'
          }
          return '默认值'
          }
      }
     });

     new Vue({
         el: '#app2',
         data: {
             msg:  'vue filter2'
             
         }
     })
  </script>
</body>
</html>
